package net.siren93.smh.entity;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created by siren93 on 15/10/14.
 */
@Entity
@Table(name = "Task", schema = "", catalog = "ptm")
public class TaskEntity {
    private int id;
    private String name;
    private Date createDate;
    private String status;
    private Integer priority;
    private int projectId;
    private int employeeId;

    @Id
    @Column(name = "id", nullable = false, insertable = true, updatable = true)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name", nullable = false, insertable = true, updatable = true, length = 20)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "create_date", nullable = false, insertable = true, updatable = true)
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "status", nullable = true, insertable = true, updatable = true, length = 20)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "priority", nullable = true, insertable = true, updatable = true)
    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    @Basic
    @Column(name = "project_id", nullable = false, insertable = true, updatable = true)
    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    @Basic
    @Column(name = "employee_id", nullable = false, insertable = true, updatable = true)
    public int getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(int employeeId) {
        this.employeeId = employeeId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TaskEntity entity = (TaskEntity) o;

        if (id != entity.id) return false;
        if (projectId != entity.projectId) return false;
        if (employeeId != entity.employeeId) return false;
        if (name != null ? !name.equals(entity.name) : entity.name != null) return false;
        if (createDate != null ? !createDate.equals(entity.createDate) : entity.createDate != null) return false;
        if (status != null ? !status.equals(entity.status) : entity.status != null) return false;
        if (priority != null ? !priority.equals(entity.priority) : entity.priority != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (priority != null ? priority.hashCode() : 0);
        result = 31 * result + projectId;
        result = 31 * result + employeeId;
        return result;
    }
}
